﻿Imports System.Data.OleDb

Partial Public Class DiscussionTopic
    Inherits System.Web.UI.Page

    Dim conn As New OleDbConnection(ConfigurationManager.ConnectionStrings("PlacesConnectionString").ToString())

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_Reply_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_Reply.Click
        Dim id = Request.QueryString("ID")
        Dim sql As String = "INSERT INTO DiscussionReply(UserName,ReplyTime,Reply,Discussion_fkid) VALUES(@UserName,@ReplyTime,@Reply,@Discussion_fkid)"
        Dim cmd As New OleDbCommand(sql, conn)
        cmd.Parameters.AddWithValue("@UserName", User.Identity.Name)
        cmd.Parameters.AddWithValue("@ReplyTime", DateString)
        cmd.Parameters.AddWithValue("@Reply", tb_Reply.Text)
        cmd.Parameters.AddWithValue("@Discussion_fkid", id)
        conn.Open()
        cmd.ExecuteNonQuery()
        cmd.Dispose()
        conn.Close()
        DetailsView1.DataBind()
        ListView1.DataBind()
    End Sub
End Class